package com.erpanderp.wam.tm.model.service;

import org.hibernate.FlushMode;
import org.hibernate.Session;

import com.erpanderp.wam.tm.model.entity.RRFBudget;
import com.erpanderp.wam.util.HibernateUtil;

public class RRFBudgetDAO {
	
	public RRFBudget saveOrUpdateAssetHistory(RRFBudget rrfBudget) {
		try {
			Session session = HibernateUtil.getSessionFactory()
					.getCurrentSession();
			session.getTransaction().begin();
			System.out.println("FLUSH MODE: " + session.getFlushMode());
			session.setFlushMode(FlushMode.COMMIT);
			session.saveOrUpdate(rrfBudget);
			session.getTransaction().commit();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
		return rrfBudget;
	}	

}
